Fix SQLite Update query generation#4028
Open
compiledpanda wants to merge 2 commits intosqlc-dev:mainfrom
Open
Conversation
kyleconroy
requested changes
Aug 2, 2025
Collaborator
kyleconroy
left a comment
There was a problem hiding this comment.
Can you add a test for this? It's helpful so that we don't break this in the future.
Author
|
@kyleconroy I added an e2e test for uppercase tables/relations in sqlite. The tests fail when you revert the identifier change in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Resolve the issue described in #3852 where update statements fail when generating queries. Note that this regression was introduced in 1.28.0 and is currently affecting the latest release (1.29.0).
Background
In commit 58b08ae the table names in sqlite queries were normalized (i.e. lower cased). In that commit a number of changes were made in the file
internal/engine/sqlite/convert.goto lowercase tables names during query parsing so that the table names would always match the table names pulled from the schema even if the casing is different. The linked issue above exists because the table name in update statements was not included in the linked set of changes last year. In essence, if you used an uppercase table name in your update query (i.e.UPDATE MY_TABLE ...) it will not match the parsed table name which is currently being converted to lowercase (i.e.my_table).Changes
identifier()function inconvertUpdate_stmtContext()so thattableNameis properly cased before it is returned and used.